package com.sjd.mall.mapper;


import com.sjd.mall.domain.SjdOrderDO;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 订单表(SjdOrder)表Mapper
 *
 * @author seer
 * @date 2022-01-11 22:28:04
 */
public interface SjdOrderMapper {

    /**
     * 增加
     *
     * @param sjdOrder sjdOrder
     * @return count
     */
    int insert(SjdOrderDO sjdOrder);

    /**
     * 根据id查询
     *
     * @param id 主键
     * @return SjdOrderDO
     */
    SjdOrderDO getById(Long id);

    /**
     * 查询
     *
     * @param orderNo orderNo
     * @return object
     */
    SjdOrderDO getByOrderNo(@Param("orderNo") String orderNo);

    /**
     * 更新有值字段
     *
     * @param orderDO orderDO
     * @return object
     */
    int updateSelectiveByOrderNo(SjdOrderDO orderDO);

    /**
     * 查询
     *
     * @param memberId    memberId
     * @param orderStatus orderStatus
     * @param goodsClass  goodsClass
     * @return object
     */
    List<SjdOrderDO> listByMember(@Param("memberId") Long memberId, @Param("orderStatus") Integer orderStatus, @Param("goodsClass") Integer goodsClass);

    /**
     * 查询创建状态订单
     *
     * @param startTime startTime
     * @return object
     */
    List<SjdOrderDO> listCreate(@Param("startTime") LocalDateTime startTime);

    /**
     * 查询
     * 包含订单状态
     * {@link com.sjd.mall.enums.OrderStatus#PAY_SUCCESS}
     * {@link com.sjd.mall.enums.OrderStatus#DELIVER_SUCCESS}
     * {@link com.sjd.mall.enums.OrderStatus#RECEIPT_SUCCESS}
     *
     * @param goodClass goodClass
     * @param startTime startTime
     * @param endTime   endTime
     * @return object
     */
    List<SjdOrderDO> listPositive(@Param("goodClass") Integer goodClass, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
}
